<?php
	
	namespace Aspic\Session;
	
	use Aspic as A;
	use Aspic\File\File;
	
	class PhpSession extends AbstractSession {
		
		
		public function __construct($lifeTime = 86400, array $options = array()) {
			parent::__construct($lifeTime, $options);
			
			session_set_cookie_params($lifetime);
			session_start();
		}
		
		public function regenerateId() {
			session_regenerate_id();
		}
		
		############### READ / WRITE METHODS ##########################
		
		protected function saveSession($id, $data) {
			$sessionInfos = $data;
			unset($sessionInfos['data']);
			
			$_SESSION = $data['data'];
		}
		
		protected function getSessionData($id) {
			$data['data'] = $_SESSION;
			
			return $data;
		}
		
		/**
		* Remove a session
		*/
		protected function removeSession($id) {
			session_destroy();
		}
		
		protected function getAllSessions() {
			return null;
		}
		
		protected function generateId() {
			return null;
		}
		
		/**
		* Check if it is time to clean session folder (or other storage way)
		*/
		protected function checkClean() {
			return null;
		}

		protected function clean() {
			return null;
		}

		protected function sessionIdExists($id) {
			return true;
		}
		
	}
	
?>